//
// Created by longyunbo on 7/21/21.
//

#include "StackValue.h"

StackValue::StackValue(){

};

int StackValue::getType(){
    return type;
};

void StackValue::setType( int va ){
    printf(" va %d \n" , va );
    type = va;
};

StackValue::StackValue(int ty, int va){
    this->type = ty;
    this->val = va;
};

StackValue::StackValue(int type, float v){
    this->type = type;
    this->data = dt->floatToChar(v);
};

StackValue::StackValue(int type, long v){
    this->type = type;
    this->data = dt->longToChar(v);
};

long* StackValue::getLongData(){
    return dt->charToLong(data);
};

int StackValue::getIntData(){
    return val;
};

float StackValue::getfloatData(){
    return dt->charToFloat(data);
}


StackValue :: ~StackValue(){
    if( dt == nullptr ){
        delete dt;
    }
    if( data == nullptr ){
        delete data;
    }
}






